// 引入接口
import {menuList} from '@/request/api'

// 封装一个接口类型
interface StateMenu{
    menulist:Array<object>
}

const state={
    menulist:[]
}

const getters={
    getMenu(state:StateMenu){
        return state.menulist   
    }
    
}

const mutations={
    REQ_MENULIST(state:StateMenu,payload:any){
        state.menulist=payload
    }
    
}

const actions={
    getMenuAction(context:any){
        menuList().then(res=>{    
            context.commit('REQ_MENULIST',res.list)
            // console.log(res.list);
            
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    // 命名空间
    namespaced:true
}